package me.kany.project.spring.boot.controller.main;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;

import me.kany.project.spring.boot.controller.IndexController;
import me.kany.project.spring.boot.model.BlogDoc;

/**
 * Created by Jason.Wang on 2016/6/23.
 */
@RestController
@RequestMapping("/main")
public class MainIndexController {
    private Logger logger = LoggerFactory.getLogger(IndexController.class);

    /**
     *
     * index:默认访问的首页信息. <br/>
     *
     * @author Jason.Wang
     * @return
     * @since JDK 1.7
     */
    @RequestMapping("")
    public ModelAndView index(BlogDoc blogDoc) {
        ModelAndView result = new ModelAndView("front/main/index");
        result.addObject("today", new Date());
        logger.debug("请求数据：" + JSONObject.toJSONString(blogDoc));
        return result;
    }
}
